<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>品种管理</title>
    <link href="https://cdn.bootcss.com/normalize/7.0.0/normalize.css" rel="stylesheet">
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
    <script src="https://cdn.bootcss.com/twitter-bootstrap/3.4.1/js/bootstrap.js"></script>
    <!--3.验证规则样式-->
    <link href="https://cdn.bootcss.com/jquery.bootstrapvalidator/0.5.3/css/bootstrapValidator.css" rel="stylesheet">
    <!--4.核心验证文件-->
    <script src="https://cdn.bootcss.com/jquery.bootstrapvalidator/0.5.3/js/bootstrapValidator.js"></script>
    <!--5.中文校验-->
    <script src="https://cdn.bootcss.com/jquery.bootstrapvalidator/0.5.3/js/language/zh_CN.js"></script>
    <link rel="stylesheet" href="lib/css/pagination.css">
    <script src="lib/pagination.js"></script>


    <script>
        $(function () {

        })
    </script>

</head>
<body>
<div class="" >
    <ul class="nav nav-tabs">
        <li role="presentation" class="active"><a href="#">我的桌面</a></li>
        <li role="presentation"><a href="#">客户管理</a></li>
        <li id="" role="presentation"><a href="#">供应商管理</a></li>
        <li role="presentation"><a href="kind_management.html">品种管理</a></li>
        <li role="presentation"><a href="#">品种库存</a></li>
        <li role="presentation"><a href="#">库存管理</a></li>
    </ul>
</div>
<div>
    <div class="form-control">
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                            data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                </div>

                <!-- Collect the nav links, forms, and other content for toggling -->
                <div class="float：left" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                               aria-haspopup="true" aria-expanded="false">按名称 <span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="#">按名称</a></li>
                                <li><a href="#">按规格</a></li>
                                <li><a href="#">按编号</a></li>
                                <li><a href="#">按型号</a></li>
                            </ul>
                        </li>
                    </ul>
                    <form class="navbar-form navbar-left">
                        <div class="form-group">
                            <input type="text" class="form-control" placeholder="请输入关键字">
                        </div>
                        <button type="submit" class="btn btn-default">查找</button>
                    </form>
                </div><!-- /.navbar-collapse -->
            </div><!-- /.container-fluid -->
        </nav>
    </div>
    <div class="table">
        <table class="table table-hover table-bordered table-condensed" >
            <tr>
                <th>品种名称</th>
                <th>编号</th>
                <th>规格</th>
                <th>型号</th>
                <th>买价</th>
                <th>卖价</th>
                <th>状态</th>
            </tr>
            <tr>
                <td></td>
            </tr>
        </table>
    </div>

    <div id="pagination">
        <script>
            $(function () {
                let data = {
                    page: 1,
                    size: 10
                }
                $.get("http://localhost:8080/kindManage/list", data, function (result) {
                    if (result.status === 200) {
                        let page = result.data
                        //alert(page.data)
                        if (page.data.length > 0) {  //
                            //alert(page.data.length)  // 可行

                            for (let i = 0; i < page.data.length; i++) {
                                let customer = page.data[i]
                                //alert(customer.cName)  // 可行
                                $("#content")
                                    .append(
                                        $("<tr>")
                                            .append(
                                                //添加客户名称
                                                $("<td>")
                                                    .text(customer.kindName)
                                                    .addClass("text-center")
                                            )
                                            // 添加所属行业
                                            .append(
                                                $("<td>")
                                                    .text(customer.cIndustry)
                                                    .addClass("text-center")
                                            )
                                            // 所在城市
                                            .append(
                                                $("<td>")
                                                    .text(customer.cCity)
                                                    .addClass("text-center")
                                            )
                                            // 联系人
                                            .append(
                                                $("<td>")
                                                    .text(customer.cLinkman)
                                                    .addClass("text-center")
                                            )
                                            // 操作
                                            .append(
                                                $("<td>")
                                                    .append($("<button class='btn btn-info off'>编辑</button>")).click(function () {
                                                    window.location.href = "detailedMSG.html?id=" + customer.cid
                                                }).append($("<button class='btn btn-danger'>删除</button>")).click(function () {
                                                    // 发送post请求 删除数据
                                                    $(this).parent("tr").remove()
                                                })
                                            )
                                            .append()
                                            .append()
                                    )
                            }

                        } else {
                            $("#content")
                                .before($("<p>暂无数据</p>"))
                                .hide();
                        }
                    } else {
                        $("#content")
                            .before($("<p>暂无数据</p>"))
                            .hide();
                    }
                })
            })
        </script>
    </div>
    <div>
        <nav aria-label="Page navigation">
            <ul class="pagination">
                <li>
                    <a href="#" aria-label="Previous">
                        <span aria-hidden="true">&laquo;</span>
                    </a>
                </li>
                <li><a href="#">1</a></li>
                <li><a href="#">2</a></li>
                <li><a href="#">3</a></li>
                <li><a href="#">4</a></li>
                <li><a href="#">5</a></li>
                <li>
                    <a href="#" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            </ul>
        </nav>
    </div>
</div>



</body>
</html>